
<template>
  <div class="butt-list-sty slotModule">
    <div v-if="topitemSelectList.length>0" class="butt-list-sty-wrap">
      <div
        v-for="(item, index) in topitemSelectList"
        :key="index"
        :class="index === itemtypeactive ? 'basebut1' : 'basebut2'"
        @click="itemtypeactive = index"
      >{{ item.name }}</div>
    </div>
  </div>
</template>

<script>
export default {
  props: {
    topitemSelectList: {
      type: Array,
      default: () => {
        return [];
      },
    },
  },
  data() {
    return {
      itemtypeactive: 0,
      // topitemSelectList: [{ id: 'CONFIG', name: '设备检查项配置' }, { id: 'TEMPLATE', name: '检查项模板配置' }]
    };
  },
  watch: {
    itemtypeactive(newvalue) {
      this.selbut(newvalue);
    },
  },
  created() {},
  mounted() {
    this.selbut(0);
  },
  methods: {
    selbut(i) {
      this.$emit("topitemtype", this.topitemSelectList[i]["id"]);
    },
  },
};
</script>
<style lang="scss" scoped>
@import "~@/styles/variables.scss";
.butt-list-sty {
  width: calc(100% - 40px);
  padding: 0 20px;
  overflow: hidden;
}
.slotModule {
  width: 100%;
  margin-bottom: 5px;
}
.slotModule > div {
  box-sizing: border-box;
  background: $hamburgerBgColor;
}
.butt-list-sty-wrap {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  overflow-x: auto;
}
.basebut1 {
  height: 36px;
  line-height: 36px;
  font-size: 17px;
  text-align: center;
  background-image: linear-gradient(#0fa1d2, #1087af, #106f8f);
  border: #f6f9f9 1px solid;
  border-radius: 19px;
  color: #ffffff;
  cursor: pointer;
  margin: 3px 5px;
  padding: 0 40px;
  white-space: nowrap;
  // transform: translateY(50%);
}
.basebut2 {
  // width: 120px;
  height: 35px;
  line-height: 35px;
  font-size: 17px;
  text-align: center;
  background-color: #106986;
  border-radius: 30px;
  color: #ffffff;
  cursor: pointer;
  margin: 3px 5px;
  padding: 0 40px;
  white-space: nowrap;
  // transform: translateY(50%);
}
</style>

